package org.ilead.iserve.model;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

/**
 * 用户和系统信件之间的关联关系
 * UserSystemMessageAssociate entity. @author MyEclipse Persistence Tools
 */

public class UserSystemMessageAssociate implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Integer id;
	private Integer messageId;
	private Integer userId;
	/**
	 * 标识信件状态，0为未读，1为已读, -1为已删除
	 */
	private Integer state;

	// Constructors

	/** default constructor */
	public UserSystemMessageAssociate() {
	}

	/** full constructor */
	public UserSystemMessageAssociate(Integer userId, Integer messageId, Integer state) {
		this.userId = userId;
		this.messageId = messageId;
		this.state = state;
	}

	// Property accessors

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getMessageId() {
		return this.messageId;
	}

	public void setMessageId(Integer messageId) {
		this.messageId = messageId;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public Integer getState() {
		return this.state;
	}

	public void setState(Integer state) {
		this.state = state;
	}
	
	public boolean equals(Object obj){
		if(obj == this)
			return true;
		if(!(obj instanceof UserSystemMessageAssociate))
			return false;
		
		UserSystemMessageAssociate asso = (UserSystemMessageAssociate) obj;
        return new EqualsBuilder()
                 .append(this.messageId, asso.getMessageId())
                 .append(this.userId, asso.getUserId())
                 .isEquals();
	}
	
	public int hashCode(){
		return new HashCodeBuilder()
        .append(this.messageId)
        .append(this.userId).toHashCode();
	}

}